package com.platform.module.service.impl;

import java.util.List;
import java.util.Arrays;
import com.platform.common.utils.DateUtils;
import com.platform.module.mapper.BaseValveDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.platform.module.mapper.ValveRecordMapper;
import com.platform.module.domain.ValveRecord;
import com.platform.module.service.IValveRecordService;
import com.platform.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 阀门数据记录Service业务层处理
 * 
 * @author wangqi
 * @date 2020-07-24
 */
@Service
public class ValveRecordServiceImpl extends ServiceImpl<ValveRecordMapper,ValveRecord> implements IValveRecordService
{
    @Autowired
    private ValveRecordMapper valveRecordMapper;
    @Autowired
    private BaseValveDataMapper valveDataMapper;
    /**
     * 查询阀门数据记录列表
     * 
     * @param valveRecord 阀门数据记录
     * @return 阀门数据记录
     */
    @Override
    public List<ValveRecord> selectValveRecordList(ValveRecord valveRecord)
    {
        return valveRecordMapper.selectValveRecordList(valveRecord);
    }

    /**
     * 新增阀门数据记录
     * 
     * @param valveRecord 阀门数据记录
     * @return 结果
     */
    @Override
    public int insertValveRecord(ValveRecord valveRecord)
    {
        valveRecord.setCreateTime(DateUtils.getNowDate());
        return valveRecordMapper.insert(valveRecord);
    }

    /**
     * 修改阀门数据记录
     * 
     * @param valveRecord 阀门数据记录
     * @return 结果
     */
    @Override
    public int updateValveRecord(ValveRecord valveRecord)
    {
        valveRecord.setUpdateTime(DateUtils.getNowDate());
        return valveRecordMapper.updateById(valveRecord);
    }

    /**
     * 删除阀门数据记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteValveRecordByIds(String ids)
    {
        return valveRecordMapper.deleteBatchIds(Arrays.asList(Convert.toStrArray(ids)));
    }

    /**
     * 删除阀门数据记录信息
     * 
     * @param id 阀门数据记录ID
     * @return 结果
     */
    @Override
    public int deleteValveRecordById(Long id)
    {
        return valveRecordMapper.deleteById(id);
    }
}
